package com.buaa.aimall.goodsModule.Entity;

import com.baomidou.mybatisplus.annotation.*;
import com.buaa.aimall.modelModule.Entity.ModelEntity;
import com.buaa.aimall.computeModule.Entity.ComputeEntity;
import com.buaa.aimall.Utils.Enum.ChargeTypeEnum;
import com.buaa.aimall.Utils.Enum.WorkOrderStatusEnum;
import com.github.yulichang.annotation.EntityMapping;
import lombok.Data;
import lombok.experimental.FieldNameConstants;

import java.time.LocalDateTime;

@TableName(value = "goods_order")
@FieldNameConstants
@Data
public class GoodsOrderEntity {

    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    private String id;

    @TableField("fk_model")
    private String modelID;

    @TableField("fk_compute")
    private String computeID;

    @TableField(exist = false)
    @EntityMapping(thisField = Fields.modelID, joinField = Fields.id)
    private ModelEntity model;

    @TableField(exist = false)
    @EntityMapping(thisField = Fields.computeID, joinField = Fields.id)
    private ComputeEntity compute;

    @TableField("fk_buyer")
    private String buyerID;

    @TableField("amount")
    private Integer amount;

    @TableField("create_time")
    private LocalDateTime createTime;

    @TableField("type")
    private ChargeTypeEnum type;

    @TableField("quantity")
    private int quantity;

    @TableField(exist = false)
    private WorkOrderStatusEnum status;

    @TableField("fk_transaction_order_id")
    private String transactionOrderID;
}
